#!/bin/bash
path=$1
mkdir -p "$path"
cd "$path"

in=0
for i in "$@"
do
    if [ $in = 0  ]; then
        in=$((in+1))
        continue
    fi
    p=`echo "${i}"|awk -F / '{print $3;}'|awk -F : '{print $1;}'`
    q=`echo "${i}"|awk -F : '{print $3;}'`
    echo "${i} ${p} ${q}"
    docker pull ${i}
    docker save ${i} > ${p}_${q}.image
    gzip -f ${p}_${q}.image
done

echo "complete!"
